var http=require('http'); 
var puerto=process.argv[2]?process.argv[2]:8080;
http.createServer(function (req, res) { 
    var split_url=req.url.split("/"); 
    if ( split_url[1] == '' ) { 
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Portada'); 
    } else if ( split_url[1] == 'cafe' ) {
    res.writeHead(418, {'Content-Type': 'text/html'});
    res.end('<html><head><title>Error 418</title></head><body><img src="http://img1.etsystatic.com/015/0/6282683/il_570xN.434137293_16c9.jpg"></body></html>');
    } else {
    res.writeHead(404, {'Content-Type': 'text/html'});
    res.end('<html><head><title>Error 404</title></head><body>Error 404: File not found</body></html>');
    } 
}).listen(puerto, '127.0.0.1'); 
console.log('Server running at http://127.0.0.1:'+puerto+'/');